package com.googlecode.grtframework.core;

/**
 * A GRTLoggedProcess is a controllable process. It can be
 * 
 * @author ajc
 * 
 */
public abstract class GRTLoggedProcess extends Thread implements IProcess {

	protected final String name;
	protected boolean running;
	protected boolean suspended;

	public GRTLoggedProcess(String name) {
		this.name = name;
	}

	/**
	 * 
	 * @param message
	 */
	protected void log(String message) {
		String name = this.getClass().getSimpleName() + this.name;
	}

	/**
	 * 
	 * @param name
	 * @param message
	 */
	protected void log(String name, String message) {

	}

	/**
	 * 
	 * @param data
	 */
	protected void log(double data) {

	}

	/**
	 * 
	 * @param name
	 * @param data
	 */
	protected void log(String name, double data) {

	}

	@Override
	public synchronized void initiate() {
		running = true;
		start();
	}

	@Override
	public synchronized void terminate() {
		running = false;
	}

	@Override
	public boolean isRunning() {
		return running;
	}

	@Override
	public synchronized void pause() {
		suspended = true;
	}

	@Override
	public synchronized void unPause() {
		suspended = false;
	}

	@Override
	public boolean isPaused() {
		return suspended;
	}

	/**
	 * Name
	 * 
	 * @return
	 */
	public String getID() {
		return name;
	}

}
